package com.alibaba.citrus.cr.common.enums.ordercenter;

import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * @auther dongju.fyj
 * @date 2023/4/26
 */
@Getter
public enum SalesOrderPushStatusEnum {
    SUCCESS_CREATE("创建成功", "successCreate"),
    FAIL_CREATE("创建失败", "failCreate"),
    SUCCESS_REFUSED("拒绝成功", "successRefused"),
    FAIL_REFUSED("拒绝失败", "failRefused"),
    SUCCESS_UPDATE("更新成功", "successUpdate"),
    FAIL_UPDATE("更新失败", "failUpdate"),
    SUCCESS_DELETE("删除成功", "successDelete"),
    FAIL_DELETE("删除失败", "failDelete");

    private final String orderStatus;
    private final String orderStatusCode;

    SalesOrderPushStatusEnum(String orderStatus, String orderStatusCode) {
        this.orderStatus = orderStatus;
        this.orderStatusCode = orderStatusCode;
    }

    public static SalesOrderPushStatusEnum of(String orderStatusCode) {
        return Arrays.stream(SalesOrderPushStatusEnum.values()).filter(source -> Objects.equals(orderStatusCode, source.getOrderStatus())).findFirst().orElse(null);
    }

}
